<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/admin/common/inc/incSession.jsp" %>
<jsp:include page="/admin/common/inc/Top.jsp" />
<%
	
	String eventId = util.getStr(request.getParameter("eventId"));
	String srchEventType = util.getStr(request.getParameter("srchEventType"));
	String srchCategoryCode = util.getStr(request.getParameter("srchCategoryCode"));
	String srchCond 	= util.getStr(request.getParameter("srchCond")); 
	String srchContent 	= util.getStr(request.getParameter("srchContent"));
	String srchUseYn 	= util.getStr(request.getParameter("srchUseYn"));
	
	String srchCond2 	= util.getStr(request.getParameter("srchCond2")); 
	String srchContent2 = util.getStr(request.getParameter("srchContent2"));
	String srchStdt2 	= util.getStr(request.getParameter("srchStdt2"));
	String srchEndt2 	= util.getStr(request.getParameter("srchEndt2"));
	String srchUseYn2 	= util.getStr(request.getParameter("srchUseYn2"));


	// paging
	String perRow 		= util.getStr(request.getParameter("perRow"));
	String startRow 	= util.getStr(request.getParameter("startRow"));
	String currentPage 	= util.getStr(request.getParameter("currentPage"));
	
	String perRow2 		= util.getStr(request.getParameter("perRow2"));
	String startRow2 	= util.getStr(request.getParameter("startRow2"));
	String currentPage2	= util.getStr(request.getParameter("currentPage2"));
	
	perRow2 = "".equals(perRow2) ?"10":perRow2;
	startRow2 = "".equals(startRow2)?"0":startRow2;
	currentPage2 = "".equals(currentPage2)?"1":currentPage2;
	
	
%>
<script type="text/javascript">
	// 리스트 갯수
	var dispCnt = '${dispCnt}';
	
	$(document).ready(function() {
		
		createCalendar();
		
	    // 달력 토글
		$('#calToggle').bind('click', function(event){
			
				$('#dhtmlxDblCalendar').toggle();
		});
		//	초기값 셋팅
		$("#srchEventType").val("<%=srchEventType%>");
		$("#srchCategoryCode").val("<%=srchCategoryCode%>");
		$("#srchCond").val("<%=srchCond%>");
		$("#srchContent").val("<%=srchContent%>");
		$("#srchUseYn").val("<%=srchUseYn%>");
		$("#eventId").val("<%=eventId%>");
		
		$("#srchCond2").val("<%=srchCond2%>");
		$("#srchContent2").val("<%=srchContent2%>");
		$("#srchStdt").val("<%=srchStdt2%>");
		$("#srchEndt").val("<%=srchEndt2%>");
		$("#srchUseYn2").val("<%=srchUseYn2%>");
		
		$("#startRow").val("<%=startRow%>");
		$("#currentPage").val("<%=currentPage%>");
		$("#startRow2").val("<%=startRow2%>");
		$("#currentPage2").val("<%=currentPage2%>");
		
		
		
		//	검색
		$("#btnSearch").click(function() {
			
			$("#listForm").attr("action","/admin/review/reviewList.jsp");
			$("#listForm").attr("target","_top");		
			$("#listForm").submit();
			
		});
		
		//	페이지 이동
		jQuery("a[name^='goPage']").click(function(){
			
			$("#startRow2").val($(this).attr("startRow"));
			$("#currentPage2").val($(this).attr("currentPage"));
			$("#listForm").attr("action","/admin/review/reviewList.jsp");
			$("#listForm").attr("target","_top");		
			$("#listForm").submit();
			
		});
		
		
		//	목록으로
		$("#btnList").click(function() {
			
			$("#listForm").attr("action","/admin/review/eventList.jsp");
			$("#listForm").attr("target","_top");		
			$("#listForm").submit();
			
		});
		
		
		//	초기화
		$("#btnReset").click(function() {
			
			$("input[type=text]").val("");
			$("select").val("");
		});
		
		// 상세
	    jQuery("a[name^='detailAnc']").click(function(){
	    	
	    	$('#eventId').val($(this).attr("eventId"));
	    	$('#idx').val($(this).attr("idx"));
	    	$("#listForm").attr("action","/admin/review/reviewDetail.jsp");
			$("#listForm").attr("target","_top");		
			$("#listForm").submit();

	    });
		
	});
		
</script>	
	<body>
		<!-- header -->
		<div id="header">
			<jsp:include page="/admin/common/inc/Header.jsp" />
		</div>
		<!-- //header -->
		
		<!-- wrap -->
		<div id="wrap">
		
			<!-- contentWrap -->
			<div id="contentWrap">
			
				<!-- topmenu -->
				<jsp:include page="/admin/common/inc/TopMenu.jsp" />
				<!-- //topmenu -->
				
				
				<div id="conts">
				
					<div class="main_view clfix">
						<!-- content -->
						
						
						<form id="listForm" name="listForm" method="post">
						<input type="hidden" name="srchEventType" id="srchEventType" value="" />
						<input type="hidden" name="srchCategoryCode" id="srchCategoryCode" value="" />
						<input type="hidden" name="srchCond" id="srchCond" value="" />
						<input type="hidden" name="srchContent" id="srchContent" value="" />
						<input type="hidden" name="startRow" id="startRow" value="" />
						<input type="hidden" name="currentPage" id="currentPage" value="" />
						
						
						<input type="hidden" name="eventId" id="eventId" value="" />
						<input type="hidden" name="idx" id="idx" value="" />
						<input type="hidden" name="startRow2" id="startRow2" value="" />
						<input type="hidden" name="currentPage2" id="currentPage2" value="" />
						<div class="section_main" style="height: 700px;">
							
							
							<!--board input-->
							<table class="bdc_input mb10">
								<colgroup><col width="20%"><col width="32%"><col width="20%"><col width="28%"></colgroup>
								<tr>
									<th class="cth">검색조건</th>
									<td class="ctd">
										<select id="srchCond2" name="srchCond2">
											<option value="">선택</option>
											<option value="MEMBER_ID">등록자</option>
											<option value="REVIEW_TITLE">제목</option>
											<option value="CONTENT">내용</option>
										</select>
										<input type="text" class="txt" style="width:150px;" id="srchContent2" name="srchContent2" value="">
									</td>
									<th class="cth">사용여부</th>
									<td class="ctd">
										<select id="srchUseYn2" name="srchUseYn2">
											<option value="">전체</option>
											<option value="Y">Y</option>
											<option value="N">N</option>
										</select>
									</td>
								</tr>
								<tr>
									<th class="cth">등록일자</th>
									<td class="ctd" colspan="3">
										<input id="srchStdt" name="srchStdt2" type="text" class="txt" style="width: 60px;" readonly="true" value=""/> ~ 
							   	   		<input id="srchEndt" name="srchEndt2" type="text" class="txt" style="width: 60px;" readonly="true" value=""/>
							   			<img name="calToggle" id="calToggle" src ="/common/calendar/imgs/icon_minicalendar.gif" style="cursor: pointer;"/>
									    <div id="dhtmlxDblCalendar" style="position: absolute;"></div>
									</td>
								</tr>
							</table>
							<!--//board input-->
							
							
							<!--btn-->
							<div class=" al_center mb10">
								<button type="button" id="btnSearch">조회</button>
								<button type="button" id="btnReset">초기화</button>
							</div>
							<!--//btn-->
						
							<!--board list-->
							<div class="board_list mb10">
								<table style="table-layout:fixed">
									<thead>
										<tr>
											<th width="50">썸네일</th>
											<th width="150">Blor URL</th>
											<th width="100">제목</th>
											<th width="200">내용</th>
											<th width="100">등록자</th>
											<th width="50">조회수</th>
											<th width="100">리뷰 등록일</th>
											<th width="70">사용여부</th>
										</tr>
									</thead>
									<tbody id="prodList" name="prodList">
									<%
									
									
										param.clear();
									
										param.put("eventId",eventId);
										param.put("srchCond",srchCond2);
										param.put("srchContent",srchContent2);
										param.put("srchStdt",srchStdt2);
										param.put("srchEndt",srchEndt2);
										param.put("srchUseYn",srchUseYn2);
										
										// paging
										param.put("perRow", perRow2);
										param.put("startRow", startRow2);
										ArrayList rs =	(ArrayList)sqlMap.queryForList("AdminReview.selectEvenReviewtList",param);	//	실행할 SQL ID, 검색조건(없을경우 null)
										
										HashMap map	 = 	(HashMap)sqlMap.queryForObject("AdminReview.selectEventReviewListTotal",param);	//	실행할 SQL ID, 검색조건(없을경우 null)
										
										for( int i = 0 ; i < rs.size() ; i++){
									%>
							            <tr>
							                <td><img src="/<%=util.getStr(((HashMap)rs.get(i)).get("THUMB_IMG")) %>" onerror="this.src='/common/images/no_prof_img.jpg'" style="width: 30px; height: 30px;" /></td>
											<td><a href="<%=util.getStr(((HashMap)rs.get(i)).get("BLOG_URL")) %>" target="_blank"><%=util.cutStr(util.getStr(((HashMap)rs.get(i)).get("BLOG_URL")), 20, "...")  %></a></td>
											<td><a href="javascript:void(0)" name="detailAnc" eventId="<%=((HashMap)rs.get(i)).get("EVENT_ID") %>" idx="<%=((HashMap)rs.get(i)).get("IDX") %>"><%=util.cutStr(util.getStr(((HashMap)rs.get(i)).get("REVIEW_TITLE")), 20, "...")  %></a></td>
											<td><%=util.cutStr(util.getStr(((HashMap)rs.get(i)).get("CONTENT")), 20, "...") %></td>
											<td><%=util.getStr(((HashMap)rs.get(i)).get("MEMBER_ID")) %></td>
											<td><%=util.getStr(((HashMap)rs.get(i)).get("RCM_CNT")) %></td>
											<td><%=util.getStr(((HashMap)rs.get(i)).get("REG_DATE")) %></td>
											<td><%=util.getStr(((HashMap)rs.get(i)).get("USE_YN")) %></td>
							            </tr>
									<%		
										}
									%>
									<%
										if( 0 >= rs.size()){
									%>							            
						            	<tr class="nodata">
						                     <td align="center" colspan="8">등록된 리뷰가 없습니다.</td>
						                </tr>
									<%
										}
									%>							            
									</tbody>
								</table>
							</div>
							<!--//board list-->
							
						
						</div>
						
						<!--//board list-->						
						<div class="section_main" style="height: 45px;">
							<%@ include file="/common/inc/paging.jsp" %>
						</div>
						</form>
						
						<!-- //content -->
						
						<!--btn-->
						<div class="al_right mb35">
							<button type="button" id="btnList">목록으로</button>
						</div>
						<!--//btn-->
						
					</div>
					
				</div>
				
			</div>
			<!-- //contentWrap -->
			
		</div>
		
		<div id="footer" style="background: url('/layoutSample/footer.png') no-repeat; height: 150px;">
		</div>
		
		<!-- //wrap -->
		
		
	
	</body>
</html>